<!DOCTYPE html>
<html>
<#include "../head.html">
    <body>
    <script>
		$("html").append('<div id="shadeLoad" style="position:fixed;left:0;top:0;height:100%;width:100%;background:rgba(0,0,0,.7) url(${request.getContextPath()}/themes/admin/images/shade_load.gif) no-repeat center center"></div>')
	</script>
    <div class="mc">
        <div>
            <div class="mc-l">
                <!--左侧导航---{-->
                <div id="navPanelContainer">
                    <div class="system-logo cd"></div>
                    <!--管理员信息---{-->
                    <#include "../adminInfo.html">
                        <!--管理员信息---}-->
                        <div class="nav-wrap">
                            <#include "left.html">
                        </div>
                </div>
                <!--左侧导航---}-->
            </div>
            <div class="mc-m">
                <div class="navToggle"></div>
            </div>
            <div class="mc-r">
                <!--顶部导航---{-->
                <#include "../topNav.html">
                    <!--顶部导航---}-->

                    <!--面包屑导航---{-->
                    <#assign moduleName="渠道推广点击统计">
                        <#include "banner.html">
                            <!--面包屑导航---}-->

                            <!--工具栏--{-->
                            <div id="toolbar" class="clearfix">
                                <div class="toolbor-module search">
                                    <input type="button" value="搜索"  class="input-button" onclick="searchResult();">
                                </div>
                                <div class="toolbor-module search">
                                    <div class="formTit">推广类型:</div>
                                    <select name="extendtype" id="extendtype">
                                        <option value="0" >所有</option>
                                        <option value="1" <#if extendtype == 1>selected="true"</#if>>CPC</option>
                                        <option value="2" <#if extendtype == 2>selected="true"</#if>>CPA</option>
                                    </select>
                                </div>
                                <div class="toolbor-module search">
                                    <div class="formTit">渠道：</div>
                                    <select name="source" id="source">
                                        <option value="" >所有</option>
                                        <#list sources as item>
                                            <#assign code = item[0] />
                                            <#assign name = item[1] />
                                            <option value="${code}">${name}</option>
                                        </#list>
                                    </select>
                                </div>
                                <div class="toolbor-module search">
                                    <div class="formTit">渠道类型:</div>
                                    <select name="type" id="type" onChange="typeChange()">
                                        <option value="0" >所有</option>
                                        <option value="1" <#if type == 1>selected="true"</#if>>IOS</option>
                                        <option value="2" <#if type == 2>selected="true"</#if>>安卓</option>
                                    </select>
                                </div>
                                <div class="toolbor-module search">
                                    <div class="formTit">截止日期：</div>
                                    <input class="_search-value" name="endTime" id="endTime" value="${endTime}" onclick="change_picktime()"/>
                                </div>
                                <div class="toolbor-module search">
                                    <div class="formTit">起始日期：</div>
                                    <input class="_search-value" name="startTime" id="startTime" value="${startTime}" onclick="change_picktime()"/>
                                </div>
                            </div>
                            <!--工具栏--}-->
                            <div id="main" class="clearfix">
                                <form action="" method="post">
                                    <table class="data-list">
                                        <tr class="header">
                                       		<td>渠道类型</td>
                                            <td>渠道编码</td>
                                            <td>渠道名称</td>
                                            <td>推广类型</td> 
                                            <td>点击用户数</td>
                                        </tr>
                                        <#if sums??>
                                        	<#list sums as item>
                                        		<tr class="s">
                                                <td>
                                                	<#if item.type == 1>
                                                		IOS
                                                	<#elseif item.type == 2>
                                                		Android
                                                	<#else>
                                                	</#if>
                                                </td>
                                                <td>${item.source!''}</td>
                                                 <td>${item.sourceName!''}</td>
                                                <td>
                                                	<#if extendtype == 1>
                                                		CPC
                                                	<#elseif extendtype == 2>
                                                		CPA
                                                	<#else>
                                                	   所有
                                                	</#if>
                                                </td>
                                                <td>${item.clickNum!0}</td>
                                                </tr>
                                        	</#list>
                                        </#if>
                                    </table>
                                </form>

                                <!--底部工具栏--{-->
                                <div id="bottomToolbar" class="clearfix">
                                    <div class="other-tool">
                                        <dl class="refresh-data">
                                            <dt class="refresh-data-icon"></dt>
                                            <dd><a href="javascript:void(0);" class="refresh-page">刷新数据</a></dd>
                                        </dl>
                                    </div>
                                 <!--翻页系统--{-->
                                 
                                    <!--翻页系统--}-->
                                </div>
                                <!--底部工具栏--}-->
                                <script>
	                               
                                    function searchResult(){
	                                    var url = 'queryClickInformation.html?search=true';
                                        var startTime = $("#startTime").val();
                                        var endTime = $("#endTime").val();
                                        var source = $("#source").val();
                                        var type = $("#type").val();
                                        var extendtype = $("#extendtype").val();
                                        url += "&source="+source;
                                        url += "&type="+type;
                                        url += "&extendtype="+extendtype;
                                        if (startTime!=null&&startTime!=""&&startTime!="undefine"){
                                            url += "&startTime="+startTime;
                                        }
                                        if (endTime!=null&&endTime!=""&&endTime!="undefine"){
                                            url += "&endTime="+endTime;
                                        }
                                        location.href=url;
                                    }
                                    
                                    function typeChange(){
                                    	var type = $("#type").val();
                                    	$.ajax({
                                 		   type: "post",
                                 		   url: "querySourceByType.html",
                                 		   data:{
                                 			   type: type
                                 		   },
                                 		   success: function(msg){
                                 			   var size = msg.length;
                                 			   var str = "<option value='' >所有</option>";
                                 			   for(var i=0;i<size;i++){
                                 				   str+= "<option value='"+msg[i][0]+"'>"+msg[i][1]+"</option>";
                                 			   }
                                 			   $("#source option").remove();
                                 			   $("#source").append(str);
                                 		   }
                                 		}); 			
                                    }
                                </script>
                            </div>

            </div>
        </div>
        <div>
            <!--尾部--{-->
            <td colspan="3" class="mc-b"><#include "../foot.html"></td>
            <!--尾部--}-->
        </div>
    </div>
	<script>
	$(window).load(function(){
		$("#shadeLoad").hide();
	});
	</script>
    </body>
</html>
<#include "../jsPage.html">
